package com.kuyu.enums;

import lombok.Getter;

/**
 * Created by 廖师兄
 * 2017-06-11 17:16
 */
@Getter
public enum PayStatusEnum {

    WAIT(0, "等待支付"),
    SUCCESS(1, "支付成功"),
    ;

    private Integer code;

    private String message;

    PayStatusEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    // 普通方法:根据索引找到对应名称
    public static String getName(int index) {
        for (PayStatusEnum c : PayStatusEnum.values()) {
            if (c.getCode() == index) {
                return c.getMessage();
            }
        }
        return null;
    }
}
